<?php


namespace app\newapi\logic;


use think\Db;

class WapshopLogic
{
    public function judgeParam($param){
        $res = ['code'=>0,'meg'=>""];

        if(empty($param['name'])){
            $res['code'] = 9999;
            $res['meg'] = "商店名称不能为空！";
            return $res;
        }

        if(empty($param['contacts'])){
            $res['code'] = 9998;
            $res['meg'] = "店主姓名不能为空！";
            return $res;
        }

        if(empty($param['contacts_tel'])){
            $res['code'] = 9997;
            $res['meg'] = "店主手机号不能为空！";
            return $res;
        }

        if(empty($param['address'])){
            $res['code'] = 9996;
            $res['meg'] = "地址不能为空！";
            return $res;
        }
    }

    public function addData($parm){
        $parm['add_time'] = date("Y-m-d H:i:s");
        $parm['status'] = 1;
        return Db::name("wap_shop")->insert($parm);
    }
}